#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t;
const ll N=2e5+5;
ll houmax[N];

void solve(){
    ll n;
    cin>>n;
    vector<ll> a(n+2, 0); 
    for (int i=1; i<=n; i++){
        cin>>a[i];
    }
    houmax[n]=a[n];
    for (int i=n-1; i>=1; i--){
        houmax[i] = max(a[i],houmax[i+1]);
    }
    
    ll xiao=a[1];
    for (int i=1; i<=n; i++){
       if (a[i]>xiao && a[i]<houmax[i])cout<<0;
       else cout<<1;
       xiao=min(xiao,a[i]);
    }
    
    cout<<endl;
}

int main(){
    cin>>t;
    while(t--){
        solve();
    }    
    return 0;
}
